package main.java.indi.zyj.sword;

import main.java.indi.zyj.hot100.base.ListNode;

public class TrainningPlan4 {

    public ListNode trainningPlan(ListNode l1, ListNode l2) {


        ListNode top = new ListNode(-1);
        ListNode p1 = l1, p2 = l2,  p = top;

        while (p1 != null && p2 != null) {
            if (p1.val <= p2.val) {
                p.next = p1;
                p1 = p1.next;
            } else {
                p.next = p2;
                p2 = p2.next;
            }
            p = p.next;
        }

        if (p1 != null) {
            p.next = p1;
        } else {
            p.next = p2;
        }

        return top.next;


    }


}
